import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
import { resolve } from "path"
import viteCompression from "vite-plugin-compression"
import { viteMockServe } from "vite-plugin-mock"

// https://vitejs.dev/config/
export default defineConfig({
  base: "./", //打包路径
  plugins: [
    vue(), // gzip压缩 生产环境生成 .gz 文件
    viteMockServe(),
    viteCompression({
      verbose: true,
      disable: false,
      threshold: 10240,
      algorithm: "gzip",
      ext: ".gz"
    })
  ],
  resolve: {
    alias: {
      "@": resolve("src")
    }
  },
  //启动服务配置
  server: {
    host: "0.0.0.0",
    port: 3000,
    open: false,
    https: false,
    proxy: {}
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: '@import "@/styles/theme.scss";'
      }
    }
  }
})
